home *** CD-ROM | disk | FTP | other *** search
Java Source | 1996-12-03 | 5.3 KB | 201 lines |
- /*
- A basic extension of the java.awt.Frame class
- */
-
- import java.awt.*;
- import symantec.itools.multimedia.SoundPlayer;
-
- public class Sound extends Frame {
- void Stop_Action(Event event) {
-
-
- //{{CONNECTION
- // Stop the sound player
- {
- soundPlayer1.stop();
- }
- //}}
- }
-
- void radioButton2_Action(Event event) {
-
-
- //{{CONNECTION
- // Add the URL of the sound file to the play list...
- {
- try {
- soundPlayer1.addURL(symantec.itools.net.RelativeURL.getURL("sounds/T2.au"));
- } catch (java.net.MalformedURLException error){
- }
- }
- //}}
- }
-
- void Play_Action(Event event) {
-
-
- //{{CONNECTION
- // Start the sound player
- {
- soundPlayer1.play();
- }
- //}}
- }
-
- void radioButton1_Action(Event event) {
-
-
- //{{CONNECTION
- // Add the URL of the sound file to the play list...
- {
- try {
- soundPlayer1.addURL(symantec.itools.net.RelativeURL.getURL("sounds/T1.au"));
- } catch (java.net.MalformedURLException error){
- }
- }
- //}}
- }
-
- void Close_Clicked(Event event) {
-
-
- //{{CONNECTION
- // Hide the Frame
- hide();
- //}}
- }
-
-
- public Sound() {
-
- //{{INIT_CONTROLS
- setLayout(null);
- addNotify();
- resize(insets().left + insets().right + 411,insets().top + insets().bottom + 198);
- setBackground(new Color(12632256));
- imageViewer2 = new symantec.itools.multimedia.ImageViewer();
- imageViewer2.reshape(insets().left + 1,insets().top + 0,104,124);
- add(imageViewer2);
- try {
- imageViewer2.setURL(symantec.itools.net.RelativeURL.getURL("images/left.gif"));
- } catch (java.net.MalformedURLException error) {
- }
- imageViewer1 = new symantec.itools.multimedia.ImageViewer();
- imageViewer1.reshape(insets().left + 306,insets().top + -1,104,113);
- add(imageViewer1);
- try {
- imageViewer1.setURL(symantec.itools.net.RelativeURL.getURL("images/right.gif"));
- } catch (java.net.MalformedURLException error) {
- }
- Stop = new symantec.itools.awt.ImageButton();
- Stop.reshape(insets().left + 104,insets().top + -1,101,72);
- add(Stop);
- Stop.setBevelHeight(1);
- Stop.setNotifyWhilePressed(false);
- Stop.setNotifyDelay(1000);
- Stop.setShowFocus(true);
- try {
- Stop.setImageURL(symantec.itools.net.RelativeURL.getURL("images/stop.gif"));
- } catch (java.net.MalformedURLException error) {
- }
- Stop.setScaleMode(false);
- Stop.setCenterMode(true);
- Play = new symantec.itools.awt.ImageButton();
- Play.reshape(insets().left + 205,insets().top + -1,101,72);
- add(Play);
- Play.setBevelHeight(1);
- Play.setNotifyWhilePressed(false);
- Play.setNotifyDelay(1000);
- Play.setShowFocus(true);
- try {
- Play.setImageURL(symantec.itools.net.RelativeURL.getURL("images/play.gif"));
- } catch (java.net.MalformedURLException error) {
- }
- Play.setScaleMode(false);
- Play.setCenterMode(true);
- Close = new java.awt.Button("Close");
- Close.reshape(insets().left + 156,insets().top + 154,97,29);
- add(Close);
- soundPlayer1 = new symantec.itools.multimedia.SoundPlayer();
- soundPlayer1.setSyncMode(true);
- soundPlayer1.setRepeat(1);
- //$$ soundPlayer1.move(120,144);
- radioButtonGroupPanel1 = new symantec.itools.awt.RadioButtonGroupPanel();
- radioButtonGroupPanel1.setLayout(null);
- radioButtonGroupPanel1.reshape(insets().left + 113,insets().top + 73,232,40);
- radioButtonGroupPanel1.setBackground(new Color(12632256));
- add(radioButtonGroupPanel1);
- Group1 = new CheckboxGroup();
- radioButton1 = new java.awt.Checkbox("Play this sound", Group1, false);
- radioButton1.reshape(24,1,198,40);
- radioButtonGroupPanel1.add(radioButton1);
- radioButtonGroupPanel2 = new symantec.itools.awt.RadioButtonGroupPanel();
- radioButtonGroupPanel2.setLayout(null);
- radioButtonGroupPanel2.reshape(insets().left + 106,insets().top + 117,302,45);
- add(radioButtonGroupPanel2);
- radioButton2 = new java.awt.Checkbox("Play this sound too", Group1, false);
- radioButton2.reshape(32,-11,190,40);
- radioButtonGroupPanel2.add(radioButton2);
- setTitle("Untitled");
- //}}
-
- //{{INIT_MENUS
- //}}
- }
-
- public Sound(String title) {
- this();
- setTitle(title);
- }
-
- public synchronized void show() {
- move(50, 50);
- super.show();
- }
-
- public boolean handleEvent(Event event) {
- if (event.id == Event.WINDOW_DESTROY) {
- hide(); // hide the Frame
- return true;
- }
- if (event.target == Close && event.id == Event.ACTION_EVENT) {
- Close_Clicked(event);
- return true;
- }
- if (event.target == radioButton1 && event.id == Event.ACTION_EVENT) {
- radioButton1_Action(event);
- return true;
- }
- if (event.target == Play && event.id == Event.ACTION_EVENT) {
- Play_Action(event);
- return true;
- }
- if (event.target == radioButton2 && event.id == Event.ACTION_EVENT) {
- radioButton2_Action(event);
- return true;
- }
- if (event.target == Stop && event.id == Event.ACTION_EVENT) {
- Stop_Action(event);
- return true;
- }
- return super.handleEvent(event);
- }
-
- //{{DECLARE_CONTROLS
- symantec.itools.multimedia.ImageViewer imageViewer2;
- symantec.itools.multimedia.ImageViewer imageViewer1;
- symantec.itools.awt.ImageButton Stop;
- symantec.itools.awt.ImageButton Play;
- java.awt.Button Close;
- symantec.itools.multimedia.SoundPlayer soundPlayer1;
- symantec.itools.awt.RadioButtonGroupPanel radioButtonGroupPanel1;
- java.awt.Checkbox radioButton1;
- CheckboxGroup Group1;
- symantec.itools.awt.RadioButtonGroupPanel radioButtonGroupPanel2;
- java.awt.Checkbox radioButton2;
- //}}
-
- //{{DECLARE_MENUS
- //}}
- }
-